import React, { Component } from 'react'
import {NavLink,withRouter} from "react-router-dom"
import RouterView  from '../router/RouterView';
export class Index extends Component {
    gotoSearch(){
        console.log(this.props);
        this.props.history.push("/search")
    }
    render() {
        let {routes} = this.props
        return (
            <div className="index">
                <header >
                    <span>头部</span>
                    <span onClick={this.gotoSearch.bind(this)}>搜索</span>
                </header>
                <main>
                    <RouterView routes={routes}/>
                </main>
                <footer>
                    <NavLink to="/index/home">首页</NavLink>
                    <NavLink to="/index/classify">分类</NavLink>
                    <NavLink to="/index/shopcar">购物车</NavLink>
                    <NavLink to="/index/my">我的</NavLink>
                </footer>
            </div>
        )
    }
}

export default withRouter(Index)
